package com.akkainaction.tool.future.actor;

import akka.actor.UntypedActor;

import java.util.concurrent.TimeUnit;

public class FutureActor extends UntypedActor {

    @Override
    public void onReceive(Object msg) throws Exception {
        System.out.println("future actor 接收到消息:[" + msg + "]");
        if (msg instanceof String) {
            if ("hello".equals(msg)) {
                //可以调整这里的休眠时间，来测试调用端超时
                TimeUnit.SECONDS.sleep(2);
                getSender().tell("reply", getSelf());
            }
        }
    }
}
